package com.njupt.mapper;

import com.njupt.po.Scoreinfo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ScoreMapper {

    @Insert("insert into scoreinfo (id,finalScore,operationTime) values " +
            "(#{id},#{finalScore},#{operationTime})")
    public int insertScore(Scoreinfo scoreinfo);

    @Delete("delete from scoreinfo where id=#{id}")
    public int deleteScore(@Param("id") String id);

    @Select("select max(id) from scoreinfo")
    public String getMaxID();

    @Select("select * from scoreinfo where operationTime like #{date} " +
            "and stuID in (select stuID from student where name like #{name})" +
            " order by operationTime DESC ")
    List<Scoreinfo> searchScore(@Param("date") String date, @Param("name")String name);
}
